COVID 19 dashboard

For the United States

Shahadat Hossain

20 April 2020

Overview

This is an RStudio shiny application developed as a part of final project in the Developing Data Products course in Coursera Data Science Specialization track. The application is a dashboard to monitor COVID-19 situation in the United States.

The leaflet map (code)

map <- us.covid.df %>%
    filter(date == max(date)) %>%
    mutate(label = paste0(type, ": ", as.character(cum)),
           Combined_Key = paste(Province_State, "US", sep = ", ")) %>%
    group_by(Combined_Key) %>%
    mutate(label = paste(label, collapse = "<br>")) %>%
    ungroup() %>%
    filter(type %in% "Confirmed cases") %>% 
    leaflet() %>%
    addTiles() %>%
    setView(lng = -97, lat = 38, zoom = 4) %>%
    addCircleMarkers(~Long, ~Lat,
                     popup = ~paste("State: <b>", Combined_Key, "</b> <br>",
                                    "Date: ", date, "<br>",
                                    label),
                     label = ~Combined_Key,
                     color = ~color,
                     radius = ~log(cum)*1.3,
                     stroke = F,
                     fillOpacity = 0.6, weight = 15) %>% 
    addEasyButton(easyButton(
        icon    = "glyphicon glyphicon-globe", title = "Reset zoom",
        onClick = JS("function(btn, map){ map.setView([38, -97], 4); }")))

The leaflet map (graph)

map

Total Confirmed cases in the US

Total number of Confirmed cases

us.covid.df %>%  group_by(type, date, color) %>%  summarise(cum = sum(cum)) %>% 
    ungroup() %>% group_by(type) %>%  plot_ly(x = ~date, y=~cum, name = ~type,
              type = 'scatter', mode = 'lines+markers', 
              opacity=0.7,  line = list(color = ~color, width = 3),
              marker = list(color = ~color, width = 3)) %>% 
      layout(xaxis = list(title = ""), yaxis = list(title = ""), legend = list(orientation = 'h'))